package com.test.p18observer.example01;

public class Client01 {
    public static void main(String[] args) {
        //创建目标对象Observerable
        ConcreteSubject subject = new ConcreteSubject();

        //创建观察者
        ObserverA obs1 = new ObserverA();
        ObserverA obs2 = new ObserverA();
        ObserverA obs3 = new ObserverA();

        subject.addObserver(obs1);
        subject.addObserver(obs2);
        subject.addObserver(obs3);

        //改变subject状态

        subject.set(300);
        System.out.println(obs3.getMyState());
    }
}
